#ifndef DATAGRAMSOCKET_H
#define	DATAGRAMSOCKET_H

#include "DatagramPackage.h"

#include <winsock2.h>

#include <stdio.h>
#include <unistd.h>

class DatagramSocket {
    public:
        DatagramSocket();
        DatagramSocket(unsigned short port);
        DatagramSocket(const char *address, unsigned short port);
        virtual ~DatagramSocket();
        
        void Bind();
        void Bind(unsigned short port);
        bool isBound();
        void Unbind();
        
        void Send(const DatagramPackage* datagram);
        void Receive(const DatagramPackage* datagram);
    private:
        SOCKET s;
        
        const char *address;
        unsigned short port;
        bool bound;
};

#endif	/* DATAGRAMSOCKET_H */
